package com.codingday.app;

import java.util.ArrayList;

import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class TODOMarker extends ItemizedOverlay<OverlayItem> {

	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	private Context mContext;
		
	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		// TODO Auto-generated method stub
		super.draw(canvas, mapView, shadow);
	}


	@Override
	protected boolean onTap(int index) {
		// TODO Auto-generated method stub
		//Toast.makeText(mContext, TODOListManager.getTODOList().get(index).getTitle(), 1).show();
		TODOMapView.getInstance().goToViewToDoActivity(TODOListManager.getTODOList().get(index).getID());
		return super.onTap(index);
	}


	public TODOMarker(Drawable defaultMarker, MapView mapView){
		super(boundCenterBottom(defaultMarker));
		Log.i("TODOMarker","Making TODOMarker");
		mContext = mapView.getContext();
	}
	
	public void addOverlay(OverlayItem overlay){
		mOverlays.add(overlay);
		setLastFocusedIndex(-1);
		populate();
	}

	@Override
	protected OverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return mOverlays.get(i);
	}

	@Override
	public int size() {
		// TODO Auto-generated method stub
		return mOverlays.size();
	}
	


}
